package com.ProtocalAndUdp;

public class SendDatas {
	/**
	 * 界面发送数据方法
	 * 
	 * @param type
	 *            类型
	 * @param protocol
	 *            协议类型
	 * @param content
	 *            包内容
	 * @throws Exception
	 */

	public static void send(String type, String protocol, String content)
			throws Exception {
		final UdpClientSocket client = UdpClientSocket.getClient();
		final byte[] bytes = (type + protocol + content).getBytes();

		android.util.Log.i("send", "发送："+type + protocol+content);
		Thread t = new Thread(new Runnable() {

			@Override
			public void run() {
				if (bytes != null) {
					try {
						client.send(bytes);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		});
		t.start();
	}
}
